//
//  JKSpeechRecognizer.h
//  苹果自带语音转文字
//
//  Created by Annie on 2020/5/11.
//  Copyright © 2020 Annie. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Speech/Speech.h>

NS_ASSUME_NONNULL_BEGIN
@class JKSpeechRecognizer;
@protocol JKSpeechRecognizerDelegate <NSObject>

- (void)speechRecognizer:(JKSpeechRecognizer *)recognizer result:(SFSpeechRecognitionResult * _Nullable)result error:(NSError * _Nullable)error;


@end


@interface JKSpeechRecognizer : NSObject
@property (nonatomic, weak) id<JKSpeechRecognizerDelegate> delegate;

/// 发送语音认证请求(首先要判断设备是否支持语音识别功能)
/// @param resultBlock 结果回调
- (void)requestAuthorizationWithResult:(void(^)(BOOL authorized))resultBlock;

/// 开始语音识别
- (void)startRecognition;

/// 结束语音识别
- (void)endRecognition;

@end

NS_ASSUME_NONNULL_END
